﻿using ScenarioFramework.WorkflowEngine.Database.WorkflowProcesses;
using ScenarioFramework.WorkflowEngine.Scheduler.Data;

namespace ScenarioFramework.WorkflowEngine.DataBase
{
    public class Helpers
    {
        private static volatile ExchangeItemHelper _ExchangeItemHelper = null;
        private static volatile WorkflowHelper _WorkflowHelper = null;
        private static volatile ActivityHelper _ActivityHelper = null;
        private static volatile KPIHelper _KPIHelper = null;

        public static ExchangeItemHelper ExchangeItem()
        {
            if (_ExchangeItemHelper == null)
            {
                lock (typeof(ExchangeItemHelper))
                {
                    if (_ExchangeItemHelper == null)
                        _ExchangeItemHelper = new ExchangeItemHelper();
                }
            }
            return _ExchangeItemHelper;
        }

        public static WorkflowHelper WorkflowHelper()
        {
            if (_WorkflowHelper == null)
            {
                lock (typeof(WorkflowHelper))
                {
                    if (_WorkflowHelper == null)
                        _WorkflowHelper = new WorkflowHelper();
                }
            }
            return _WorkflowHelper;
        }

        public static ActivityHelper ActivityHelper()
        {
            if (_ActivityHelper == null)
            {
                lock (typeof(ActivityHelper))
                {
                    if (_ActivityHelper == null)
                        _ActivityHelper = new ActivityHelper();
                }
            }
            return _ActivityHelper;
        }

        public static KPIHelper KPIHelper()
        {
            if (_KPIHelper == null)
            {
                lock (typeof(KPIHelper))
                {
                    if (_KPIHelper == null)
                        _KPIHelper = new KPIHelper();
                }
            }
            return _KPIHelper;
        }
    }
}

